from .base_handler import BaseRequestHandler
import os


class HtmlFileHandler(BaseRequestHandler):
    async def get(self, file):
        if not await self.verity_user() and file != 'login.html':
            # self.write_str('您没有访问该资源的权限！')
            self.redirect('/')
            return
        file_path = os.path.join(self.static_path, file)
        if os.path.exists(file_path):
            self.write_static(file_path)
        else:
            self.write_str('您访问的资源不存在！')


# class HtmlModuleFileHandler(BaseRequestHandler):
#     def get(self, file):
#         if not self.current_user:
#             self.write_str('您没有访问该资源的权限！')
#             return
#         fpath = os.path.join(self.static_path, file)
